package com.bauer.mq.rabbitmq.controller;

import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @description:
 * @author: weirui
 * @create: 2020-10-29 11:17
 **/
@RestController
public class SendMsgController {

    @Autowired
    private RabbitTemplate rabbitTemplate;

    @RequestMapping("/send")
    public String sendMsg(String msg){
        rabbitTemplate.convertAndSend("testExchange","test",msg.getBytes());
        return "hello";
    }
}
